home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / coreaids.arc / HELP.ASM < prev    next >
Assembly Source File  |  1988-11-20  |  3KB  |  129 lines

  1. ;    DESC:    Provides help to the user for all programs           V1.03
  2. ;        linking to the help module and following the
  3. ;        specified format
  4. ;    IN:    *{DS} value passed to data segment at start of main program
  5. ;        *{HELP} location of help data
  6. ;    OUT:    *{SEG_VAL} segment and
  7. ;        *{OFFSET} offset of parameter string
  8. ;        *{LENGTH} length of parameter string
  9. ;    SAMPLE:    Call    HELP,<DS,HELP>,<SEG_VAL,OFFSET,LENGTH>
  10. ;    ##################################################################
  11.  
  12. HELP?    Segment Para Public 'HELPINFO'
  13.         DB    0DH,0AH,'               '
  14.         DB    '             H E L P   O P T I O N S              '
  15.         DB    0DH,0AH,'               '
  16.         DB    '                                                  '
  17.         DB    0DH,0AH,'               '
  18.         DB    'blank line..............This Information          '
  19.         DB    0DH,0AH,'               '
  20.         DB    '/l......................licences and Subroutines  '
  21.         DB    0DH,0AH,'               '
  22.         DB    '?.......................Program Parameters        '
  23.         DB    0DH,0AH,'               '
  24.         DB    '                                                  '
  25. HELP?    Ends
  26.  
  27. HELPD    Segment Para Public 'HELPDATA'
  28. SNAME        DB    'CoreTechs'
  29. HELPD    Ends
  30.  
  31.     Extrn    PUSHALL:Near
  32.     Extrn    POPALL:Near
  33.     Extrn    TEXT_WRT:Near            ;writes text to screen.
  34.     Extrn    PARM_GET:Near            ;gets parameters.
  35.     Extrn    CLEAR:Near            ;clears the screen.
  36.     Extrn    CURS_SET:Near            ;sets the cursor position.
  37.     Extrn    SEARCH:Near            ;search for licences.
  38.  
  39. HELPC    Segment
  40.     Assume    CS:HELPC,DS:HELPD
  41.     Public    HELP
  42.  
  43.     Include    CALLM.MAC            ;include macro.
  44.  
  45.                         ;notice.
  46.     DB    'HELP     - V1.03, Copyright 1987, CoreTechs   ',0DH,0AH
  47.  
  48. HELP    Proc    Near
  49.     Call    PUSHALL                ;save registers.
  50.  
  51.     Pop    AX                ;help information.
  52.     Pop    BX                ;initial data area.
  53.  
  54.     Mov    DI,CX                ;save end of program mark.
  55.     Callm    PARM_GET,<BX>,<ES,BP,CX>    ;get input parameters.
  56.     Mov    DS,AX
  57.  
  58.     Call    CLEAR                ;clear screen.
  59.  
  60.     Jcxz    RQ1                ;program options.
  61.  
  62.     Cmp    ES:BYTE PTR[BP],'?'        ;request for options.
  63.     Jnz    RQ20                ;test other options.
  64.     Jmp    RQ0
  65.  
  66. RQ20:    Cmp    ES:WORD PTR[BP],'l/'        ;print licences and subs.
  67.     Jz    RQ200
  68.     Jmp    OK
  69.  
  70. RQ200:    Jmp    RQ2                ;gets around relative jump.
  71.  
  72. RQ1:    Callm    TEXT_WRT,<0,0,HELP?,0,402>,    ;print possible options.
  73.     Jmp    OUT
  74.  
  75. RQ0:    Callm    TEXT_WRT,<DS:[0],DS:[2],DS:[6],DS:[4],DS:[8]>,
  76.  
  77. OUT:    Callm    CURS_SET,<1800H,0>,
  78.     Mov    AH,4CH                ;exit program.
  79.     Int    21H
  80.  
  81. OK:    Push    CX                ;return input parameters.
  82.     Push    BP
  83.     Push    ES
  84.  
  85.     Call    POPALL                ;recover registers.
  86.     Ret
  87.  
  88. RQ2:    Mov    AX,0
  89.     Push    AX                ;save dummy.
  90.  
  91.                         ;search for licence marks.
  92. RQ21:    Pop    BX                ;save 
  93.  
  94.     Callm    SEARCH,<0,CS,BX,9,HELPD,0>,<AX,BX>
  95.     Add    BX,30H                ;move past licence.
  96.     Push    BX
  97.     Sub    BX,30H
  98.  
  99.     Cmp    AX,0                ;if AX and BX are 0 then
  100.     Jz    TST2                ;no more licences were found.
  101.     Jmp    DISP1
  102.  
  103. OUT2:    Pop    AX                ;release BX.
  104.     Jmp    OUT
  105.  
  106. TST2:    Cmp    BX,0            
  107.     Jz    OUT2
  108.     
  109. DISP1:    Cmp    CS:WORD PTR[BX+12],0A0DH    ;verify licence.
  110.     Jnz    RQ21
  111.     Mov    CS:WORD PTR[BX+12],2020H    ;modify licence to
  112.                         ;not match again.
  113.  
  114.     Sub    BX,22H                ;display licence n.
  115.     Mov    DX,BX
  116.     Add    DX,30H
  117.     Callm    TEXT_WRT,<0,1800H,AX,BX,DX>,
  118.  
  119.     Mov    AX,0601H            ;move screen up one
  120.     Mov    CX,0                ;line to prepare for
  121.     Mov    DX,184FH            ;display of next licence.
  122.     Mov    BH,07H
  123.     Int    10H                ;execute screen move.
  124.     Jmp    RQ21
  125.  
  126. HELP    Endp
  127. HELPC    Ends
  128.     End
  129.